package com.qiaofang.collectmanage.service.common.utils.phone;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class InfoIdSigneture
{
    private static final String[] a = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
//  https://apphouse.58.com/api/detail/hezu/31493920412101?v=1&platform=android&format=json&
//	  sidDict=%7B%22PGTID%22%3A%22187064447197864353428186953%22%2C%22GTID%22%3A%22109338132197864353414563548%22%7D&
//	  localname=sh&signature=0007be1c6db96e3565b4475a84e97e53&version=7.15.3
//	  &commondata=%7B%22tracekey%22%3A%22c2e4e561a47c10a4902b4e257095766f%22%2C%22hasNext%22%3Atrue%2C%22nextObserverIndex%22%3A0%7D
    //  https://apphouse.58.com/api/detail/hezu/31493920412101?v=1&platform=android&format=json&sidDict=%7B%22PGTID%22%3A%22187064447197864353428186953%22%2C%22GTID%22%3A%22109338132197864353414563548%22%7D&localname=sh&signature=0007be1c6db96e3565b4475a84e97e53&version=7.15.3&commondata=%7B%22tracekey%22%3A%22c2e4e561a47c10a4902b4e257095766f%22%2C%22hasNext%22%3Atrue%2C%22nextObserverIndex%22%3A0%7D
    public static void main(String[] args) throws UnsupportedEncodingException{
//	  String str1 = "https://apphouse.58.com/api/detail/hezu/31493920412101?v=1&platform=android&format=json&sidDict=%7B%22PGTID%22%3A%22187064447197864353428186953%22%2C%22GTID%22%3A%22109338132197864353414563548%22%7D&localname=sh&signature=0007be1c6db96e3565b4475a84e97e53&version=7.15.3&commondata=%7B%22tracekey%22%3A%22c2e4e561a47c10a4902b4e257095766f%22%2C%22hasNext%22%3Atrue%2C%22nextObserverIndex%22%3A0%7D";
//	  String jg = URLDecoder.decode(str1, "utf-8");
//	  System.out.println(jg);          0007be1c6db96e3565b4475a84e97e53
//	  								   0007be1c6db96e3565b4475a84e97e53
//	  31493920412101?sidDict={"PGTID":"187064447197864353428186953","GTID":"109338132197864353414563548"}
//	      cc787c5df00d27319b37544a16ad5473  32136176594745
//			  commondata={"tracekey":"c2e4e561a47c10a4902b4e257095766f","hasNext":true,"nextObserverIndex":0}
//	  2a3e5b1177e1f103b96c798f8ae50b33

//	  5a16cc5bf5860be4256be573c4cfa7b1   32103253609659
        String ss = "32135750141620";
        String str = sign(ss + "HOUSEPHP58");
        System.out.println(str);
    }

    private static String sign(byte paramByte)
    {
        int i = paramByte;
        if (paramByte < 0) {
            i = paramByte + 256;
        }
        paramByte = (byte) (i / 16);
        return a[paramByte] + a[(i % 16)];
    }

    public static String sign(String paramString)
    {
        try
        {
            String pp = sign(MessageDigest.getInstance("MD5").digest((paramString + "HOUSEPHP58").getBytes()));
            return pp;
        }
        catch (NoSuchAlgorithmException localNoSuchAlgorithmException2)
        {
//            for (;;)
//            {
////          paramString = localNoSuchAlgorithmException1;
//                Object localObject = localNoSuchAlgorithmException2;
//            }
            return  null;

        }
    }

    private static String sign(byte[] paramArrayOfByte)
    {
        StringBuffer localStringBuffer = new StringBuffer();
        int i = 0;
        while (i < paramArrayOfByte.length)
        {
            localStringBuffer.append(sign(paramArrayOfByte[i]));
            i += 1;
        }
        return localStringBuffer.toString();
    }
}

